/****** Object:  Table [dbo].[Document]    Script Date: 09/07/2006 14:39:55 ******/
CREATE TABLE [dbo].[Document](
	[Id] [int] NOT NULL,
	[Name] [char](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
 CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


/****** Object:  Table [dbo].[Path]    Script Date: 09/07/2006 14:43:47 ******/
CREATE TABLE [dbo].[Path](
	[PathId] [int] NOT NULL,
	[PathExp] [char](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
 CONSTRAINT [PK_Path] PRIMARY KEY CLUSTERED 
(
	[PathId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE UNIQUE NONCLUSTERED INDEX [IX_Path] ON [dbo].[Path] 
(
	[PathExp] ASC
)WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]


/****** Object:  Table [dbo].[DocumentRValue]    Script Date: 09/07/2006 14:44:02 ******/
CREATE TABLE [dbo].[DocumentRValue](
	[DocId] [int] NOT NULL,
	[Level] [int] NOT NULL,
	[RValue] [bigint] NULL,
 CONSTRAINT [PK_DocumentRValue] PRIMARY KEY CLUSTERED 
(
	[DocId] ASC,
	[Level] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


/****** Object:  Table [dbo].[PathValue]    Script Date: 09/07/2006 14:44:22 ******/
CREATE TABLE [dbo].[PathValue](
	[DocId] [int] NOT NULL,
	[LeafOrder] [int] NOT NULL,
	[BranchOrder] [int] NULL,
	[PathId] [int] NULL,
	[DeweyOrderSum] [bigint] NOT NULL,
	[SiblingSum] [bigint] NULL,
	[LeafValue] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

CREATE UNIQUE CLUSTERED INDEX [IX_PathValue_1] ON [dbo].[PathValue] 
(
	[PathId] ASC,
	[DeweyOrderSum] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = OFF) ON [PRIMARY]

CREATE NONCLUSTERED INDEX [IX_PathValue_2] ON [dbo].[PathValue] 
(
	[PathId] ASC,
	[BranchOrder] ASC
)WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]


/****** Object:  Table [dbo].[Attribute]    Script Date: 09/07/2006 14:44:34 ******/
CREATE TABLE [dbo].[Attribute](
	[DocId] [int] NOT NULL,
	[LeafOrder] [int] NOT NULL,
	[PathId] [int] NOT NULL,
	[AttrOrder] [int] NOT NULL,
	[LeafValue] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]

CREATE UNIQUE CLUSTERED INDEX [IX_Attribute_1] ON [dbo].[Attribute] 
(
	[LeafOrder] ASC,
	[PathId] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = OFF) ON [PRIMARY]

